import qs from 'qs';
import axiosInstance from '../http';

// 登录
const login = params => axiosInstance.post('/index/login/login', qs.stringify(params));
// 注册
const register = params => axiosInstance.post('/index/login/register', qs.stringify(params));
// 获取验证码
const getCode = params => axiosInstance.post('/index/Base/getCode', qs.stringify(params));
// 随机8个已担保的公司
const getIndexCompany = () => axiosInstance.get('/index/company/getIndexCompany');
// 随机获取11个已认证的公司
const getIndexcerCompany = () => axiosInstance.get('/index/company/getIndexcerCompany');
// 已收入、担保、认证总数
const getCompanyStatic = () => axiosInstance.post('/index/index/companyStatic');
// 首页广告
const getHomeAds = () => axiosInstance.post('/index/index/adList');
// 首页头条数据
const getHeadlineList = () => axiosInstance.post('/index/index/headlineList');
// 首页举报列表
const getReportList = () => axiosInstance.post('/index/index/getReportList');
// 实时受理动态
const getAcceptList = () => axiosInstance.post('/index/index/getslReportList');
// 维权出款排行
const getReportSort = () => axiosInstance.post('/index/index/reportSort');
// 获取外链
const getLinkList = () => axiosInstance.post('/index/link/getLinkList');
// 获取公司列表
const getCompanyData = params => axiosInstance.post('/index/company/getListP', qs.stringify(params));
// 保存百科
const savePedia = params => axiosInstance.post('/savePedia', qs.stringify(params));
// 优惠券列表
const getCouponList = () => axiosInstance.post('/index/article/getCouponList');
// 优惠券详情
const getCouponDetail = id => axiosInstance.get(`/index/article/getCouponDetail?id=${id}`);
// 获取百科分类
const getBkType = () => axiosInstance.get('/index/article/getBkType');
// 获取个人中心的企业列表
const getEnterpriseList = () => axiosInstance.post('/index/center/getList');

export {
  login,
  register,
  getCode,
  getCompanyData,
  savePedia,
  getLinkList,
  getCouponList,
  getCouponDetail,
  getIndexCompany,
  getIndexcerCompany,
  getCompanyStatic,
  getBkType,
  getEnterpriseList,
  getHomeAds,
  getReportSort,
  getReportList,
  getAcceptList,
  getHeadlineList
};
